package com.jamlu.framework.ui.view;

import android.support.annotation.NonNull;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jamlu.framework.model.bean.BaseBean;
import com.jamlu.framework.model.bean.BaseListBean;
import com.jamlu.framework.ui.status.IStatus;
import com.jamlu.framework.ui.status.StatusRequest;
import com.jamlu.framework.ui.status.StatusSmartRvView;

import java.util.List;

import io.reactivex.Observable;
import io.reactivex.functions.Consumer;

/**
 * Created by DMing at 2018/3/1 0001
 */

public interface IStatusView extends IBaseView{

    /**
     * 注入一个状态Toast，回调是请求
     * @param statusRequest 请求
     */
    void injectStatusToast(@NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态Dialog，能通过返回键取消，回调是请求
     * @param statusRequest 请求
     */
    void injectStatusDialog(@NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态Dialog，设置是否返回键取消，回调是请求
     * @param cancelable 是否返回取消
     * @param statusRequest 请求
     */
    void injectStatusDialog(boolean cancelable,@NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态View，回调是请求
     * @param viewGroup 布局根
     * @param statusRequest 请求
     */
    void injectStatusView(@NonNull ViewGroup viewGroup, @NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态List View,服务对象是SmartRefresh + recyclerView，回调是请求
     * @param viewGroup 布局根
     * @param baseQuickAdapter 适配器
     * @param statusRequest 请求
     */
    StatusSmartRvView injectStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态List View,服务对象是SmartRefresh + recyclerView，回调是请求
     * @param viewGroup 布局根
     * @param baseQuickAdapter 适配器
     * @param list list的类型必须与baseQuickAdapter一致
     * @param statusRequest 请求
     */
    StatusSmartRvView hasDataSmartRvView(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull StatusRequest statusRequest);

    /**
     * 把rxJava请求与状态布局结合，不提供回调参数
     */
    //自定义状态布局
    void requestStatusDefine(@NonNull IStatus iStatus, @NonNull Observable requestObservable);
    //Toast布局
    void requestStatusToast(@NonNull final Observable requestObservable);
    //Dialog布局
    void requestStatusDialog(@NonNull final Observable requestObservable);
    //Dialog布局,可选取消返回
    void requestStatusDialog(boolean cancelable,@NonNull final Observable requestObservable);
    //View布局
    void requestStatusView(@NonNull ViewGroup viewGroup,@NonNull final Observable requestObservable);
    //List布局
    StatusSmartRvView requestStatusSmartRv(@NonNull ViewGroup viewGroup,@NonNull  BaseQuickAdapter baseQuickAdapter,@NonNull final Observable requestObservable);
    //List布局,一开始就有数据，可从缓存拿
    StatusSmartRvView requestHasDataSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull final Observable requestObservable);
    /**
     * 把rxJava请求与状态布局结合，提供成功回调参数
     */
    void requestStatusDefine(@NonNull IStatus iStatus,@NonNull  Observable requestObservable,@NonNull Consumer<BaseBean> consumer);
    //自定义状态布局
    void requestStatusToast(@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer);//Toast布局
    //Dialog布局
    void requestStatusDialog(@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer);
    //Dialog布局,可选取消返回
    void requestStatusDialog(boolean cancelable,@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer);
    //View布局
    void requestStatusView(@NonNull ViewGroup viewGroup,@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer);
    //List布局
    StatusSmartRvView requestStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter,@NonNull final Observable requestObservable, @NonNull final Consumer<BaseListBean> consumer);
    //List布局,一开始就有数据，可从缓存拿
    StatusSmartRvView requestHasDataSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull final Observable requestObservable, @NonNull final Consumer<BaseListBean> consumer);
    /**
     * 把rxJava请求与状态布局结合，提供成功、失败回调参数
     */
    //自定义状态布局
    void requestStatusDefine(@NonNull IStatus iStatus, @NonNull Observable requestObservable,@NonNull Consumer<BaseBean> consumer,@NonNull Consumer<Integer> failureStatus);
    //Toast布局
    void requestStatusToast(@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer,@NonNull final Consumer<Integer> failureStatus);//Toast布局
    //Dialog布局
    void requestStatusDialog(@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer,@NonNull final Consumer<Integer> failureStatus);
    //Dialog布局,可选取消返回
    void requestStatusDialog(boolean cancelable,@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer,@NonNull final Consumer<Integer> failureStatus);
    //View布局
    void requestStatusView(@NonNull ViewGroup viewGroup,@NonNull final Observable requestObservable, @NonNull final Consumer<BaseBean> consumer,@NonNull final Consumer<Integer> failureStatus);
    //List布局
    StatusSmartRvView requestStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter,@NonNull final Observable requestObservable, @NonNull final Consumer<BaseListBean> consumer,@NonNull final Consumer<Integer> failureStatus);
    //List布局,一开始就有数据，可从缓存拿
    StatusSmartRvView requestHasDataSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull final Observable requestObservable, @NonNull final Consumer<BaseListBean> consumer,@NonNull final Consumer<Integer> failureStatus);
}
